//
//  PHStatusToolBarView.swift
//  PHWeibo
//
//  Created by 潘荟 on 16/7/23.
//  Copyright © 2016年 BAT. All rights reserved.
//

import UIKit

class PHStatusToolBarView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI() {
        
//        self.backgroundColor = UIColor.whiteColor()
        
        //添加子控件
        addSubview(retweetButton)
        addSubview(commentButton)
        addSubview(unlikeButton)
        addSubview(line1)
        addSubview(line2)
        
        //添加约束
        retweetButton.snp_makeConstraints { (make) -> Void in
            make.top.leading.bottom.equalTo(self)
            make.width.equalTo(commentButton)
        }
        
        commentButton.snp_makeConstraints { (make) -> Void in
            make.top.bottom.equalTo(self)
            make.leading.equalTo(retweetButton.snp_trailing)
            make.width.equalTo(unlikeButton)
        }
        unlikeButton.snp_makeConstraints { (make) -> Void in
            make.top.bottom.trailing.equalTo(self)
            make.leading.equalTo(commentButton.snp_trailing)
        }
        
        line1.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(self)
            make.centerX.equalTo(retweetButton.snp_trailing)
        }
        
        line2.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(self)
            make.centerX.equalTo(unlikeButton.snp_leading)
        }

    }
    
    // MARK: - 懒加载子控件
    //三个按钮
    private  lazy var retweetButton :UIButton = UIButton(title: "转发", norImageName: "timeline_card_bottom_background", highImageName: "timeline_card_bottom_background_highlighted", btnImageName: "timeline_icon_retweet")
    
    private lazy var commentButton :UIButton = UIButton(title: "评论", norImageName: "timeline_card_bottom_background", highImageName: "timeline_card_bottom_background_highlighted", btnImageName: "timeline_icon_comment")
    
    private lazy var unlikeButton :UIButton = UIButton(title: "赞", norImageName: "timeline_card_bottom_background", highImageName: "timeline_card_bottom_background_highlighted", btnImageName: "timeline_icon_unlike")
    
    //两条分割线
    private lazy var line1 : UIImageView = UIImageView(imgName: "timeline_card_bottom_line")
    
    private lazy var line2 : UIImageView = UIImageView(imgName: "timeline_card_bottom_line")
}











